import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import Home from '../views/home/HomeView.vue'
import Kind from '../views/kind/KindView.vue'
import Cart from '../views/cart/CartView.vue'
import User from '../views/user/UserView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home/:phoName?',
    name: 'home',
    component: Home
  },
  {
    path: '/kind',
    name: 'kind',
    component: Kind
  },
  {
    path: '/seach',
    name: 'seach',
    component: () => import(/* webpackChunkName: "SeachView" */ '../views/seach/SeachView.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/cart',
    name: 'cart',
    component: Cart
  },
  {
    path: '/payment',
    name: 'payment',
    redirect: '/payment/stop1',
    component: () => import(/* webpackChunkName: "PaymentView" */ '../views/payment/PaymentView.vue'),
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'stop1',
        name: 'paymentStop1',
        component: () => import(/* webpackChunkName: "Stop1View" */ '../views/payment/Stop1View.vue'),
        meta: {
          hidden: true
        }
      },
      {
        path: 'stop2',
        name: 'paymentStop2',
        component: () => import(/* webpackChunkName: "Stop2View" */ '../views/payment/Stop2View.vue'),
        meta: {
          hidden: true
        }
      },
      {
        path: 'stop3',
        component: () => import(/* webpackChunkName: "Stop3View" */ '../views/payment/Stop3View.vue'),
        meta: {
          hidden: true
        }
      }
    ]
  },
  {
    path: '/address',
    name: 'address',
    redirect: '/address/stop1',
    component: () => import(/* webpackChunkName: "AddressView" */ '../views/address/AddressView.vue'),
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'stop1',
        component: () => import(/* webpackChunkName: "AddressStop1" */ '../views/address/AddressStop1.vue'),
        meta: {
          hidden: true
        }
      },
      {
        path: 'stop2/:ressid?',
        name: 'addressStop2',
        component: () => import(/* webpackChunkName: "AddressStop2" */ '../views/address/AddressStop2.vue'),
        meta: {
          hidden: true
        }
      }
    ]
  },
  {
    path: '/user',
    name: 'user',
    component: User
  },
  {
    path: '/purchase',
    name: 'purchase',
    redirect: '/purchase/stop1',
    component: () => import(/* webpackChunkName: "PurchaseView" */ '../views/purchase/PurchaseView.vue'),
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'stop1',
        name: 'PurchaseStop1',
        component: () => import(/* webpackChunkName: "PurchaseStop1" */ '../views/purchase/PurchaseStop1.vue'),
        meta: {
          hidden: true
        }
      },
      {
        path: 'stop2',
        name: 'PurchaseStop2',
        component: () => import(/* webpackChunkName: "PurchaseStop2" */ '../views/purchase/PurchaseStop2.vue'),
        meta: {
          hidden: true
        }
      },
      {
        path: 'stop3',
        name: 'PurchaseStop3',
        component: () => import(/* webpackChunkName: "PurchaseStop2" */ '../views/purchase/PurchaseStop3.vue'),
        meta: {
          hidden: true
        }
      }
    ]
  },
  {
    path: '/order/:timeId',
    name: 'order',
    component: () => import(/* webpackChunkName: "OrderView" */ '../views/order/OrderView.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import(/* webpackChunkName: "DetailView" */ '../views/totail/DetailView.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/login/:phoid?',
    name: 'login',
    component: () => import(/* webpackChunkName: "LoginView" */ '../views/login/LoginView.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/country',
    name: 'country',
    component: () => import(/* webpackChunkName: "CountryView" */ '../views/country/CountryView.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/register',
    name: 'register',
    redirect: 'register/stap1',
    component: () => import(/* webpackChunkName: "RegisterView" */ '../views/register/RegisterView.vue'),
    meta: {
      hidden: true
    },
    children: [
      {
        // 当 /user/:id/profile 匹配成功
        // UserProfile 将被渲染到 User 的 <router-view> 内部
        path: 'stap1',
        component: () => import(/* webpackChunkName: "StapView1" */ '../views/register/StapView1.vue'),
        meta: {
          hidden: true
        }
      },
      {
        // 当 /user/:id/profile 匹配成功
        // UserProfile 将被渲染到 User 的 <router-view> 内部
        path: 'stap2',
        component: () => import(/* webpackChunkName: "StapView2" */ '../views/register/StapView2.vue'),
        meta: {
          hidden: true
        }
      },
      {
        // 当 /user/:id/profile 匹配成功
        // UserProfile 将被渲染到 User 的 <router-view> 内部
        path: 'stap3',
        component: () => import(/* webpackChunkName: "StapView3" */ '../views/register/StapView3.vue'),
        meta: {
          hidden: true
        }
      }
    ]
  },
  {
    path: '*',
    component: () => import(/* webpackChunkName: "ErrorView" */ '../views/error/ErrorView.vue'),
    meta: {
      hidden: true
    }
  }
]

// const routes = [
//   {
//     path: '/',
//     name: 'home',
//     component: HomeView
//   },
//   {
//     path: '/about',
//     name: 'about',
//     route level code-splitting
//     this generates a separate chunk (about.[hash].js) for this route
//     which is lazy-loaded when the route is visited.
//     component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
//   }
// ]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
